﻿        using System;
using System.Collections.Generic;

namespace My.Blog.Web
{
    public class ArticleUI
    {
        public static string New()
        {
            return @"
        <input type='hidden' name='BlogId' value='{UserId}' />
        <dl>
            <dt>CategoryId:</dt>
            <dd>
                <input type='text' class='CategoryId' readonly='readonly' />
                <input type='hidden' name='CategoryId' />
            </dd>
            
            <dt>Title:</dt>
            <dd><input type='text' name='Title' class='input-field' /></dd>
            
            <dt>Content:</dt>
            <dd>
                <div style='float:left;width:80%'>
                <textarea name='Content' class='textarea-content' class='clearfix' id='ArticleContent'></textarea>
                </div>
            </dd>
            
            <dt>Summary:</dt>
            <dd><textarea name='Summary' class='textarea-summary'></textarea></dd>
            
            <dt><label>Author:</label></dt>
            <dd><input type='text' name='Author' /></dd>
            
            <dt>IsOriginal:</dt>
            <dd>
                <select name='IsOriginal'><option value='true'>是</option><option value='false'>否</option></select>
            </dd>
            
            <dt>
                IsPublished:</dt>
            <dd><select name='IsPublished'><option value='true'>是</option><option value='false'>否</option></select></dd>
            
            <dt>&nbsp;</dt>
            <dd><button>提交</button></dd>
        </dl>";
        }

        public static string Index()
        {
            return @"
<h1>List</h1>
<!--<If:Empty>-->
<p> 
    <span class='h1'>没有找到您请求的文章！可能原因：</span>
    <ul>
        <li>博主还没有发表过文章</li>
        <li>没有与您输入的搜索条件匹配的文章</li>
    </ul>
</p>
<!--</If:Empty>-->

<!--<IfNot:Empty>-->
<form id='FrmListArticles' method='post' action='#'>
<div>
    <ul>
    <li>
        <span class='previewAll' title='预览全部'>预览全部</span>
        <!--<If:Maintain>-->
            <input name='checkAll' type='checkbox' value='' />全选
            <button name='del'>删除</button>
            <button name='move'>移动</button>
        <!--</If:Maintain>-->
    </li>
        
    <!--<Loop:List>-->
    <li>
        <span><!--<If:Maintain>--><input name='Ids' type='checkbox' value='{Id}' /><!--</If:Maintain>--></span>
        <span class='showHiddenSummary'>预览</span>
        <span class='h3'><a href='ArticleDetail.aspx?ArticleId={Id}'>{Title}</a></span>
        <span>{IsPublished}</span>
        <h3 style='display:none'>{Title}</h3><!--SEO-->
        
        <div class='hiddenSummary'>
            <p>{Summary}</p>
            <p><span class='left'><img src='img/icon2.gif' />&nbsp;<a href='ArticleDetail.aspx?ArticleId={Id}'>查看更多...</a></span>
               <span class='right'>作者：{Author} &nbsp;|&nbsp; 
                                     分类：<a href='#{CategoryId}'>{CategoryTitle}</a> &nbsp;|&nbsp; 
                                     查看：{VisitedCount} &nbsp;|&nbsp; 
                                     评论：{CommentsCount}</span></p>
        </div>
        <div class='clear2'></div>
    </li>
    <!--</Loop:List>-->
        
    </ul>
    <div class='green-black'>{Page}</div>
</div>
</form>

<!--<If:Maintain>-->
    <ul id='MoveArticleUi' style='display:none'>
        <li>
            <label>CategoryId:</label><input type='text' class='CategoryId' readonly='readonly' />
                                      <input type='hidden' name='CategoryId' />
        </li>
        <button>提交</button>
    </ul>
<!--</If:Maintain>-->
";
        }
        public static string Update()
        {
            return @"
    <div class='hiddenForm bd'>
        <input type='hidden' name='Id' value='{Id}' />
        <ul>
            <li>
                <label>Title:</label><input type='text' name='Title' value='${Title}' class='input-field' />
            </li>
            <li>
                <label>Content:</label><textarea name='Content'  class='textarea-content' id='ArticleContent'>{Content}</textarea>
            </li>
            <li>
                <label>Summary:</label><textarea name='Summary' class='textarea-summary'>{Summary}</textarea>
            </li>
            <li>
                <label>Author:</label><input type='text' name='Author' value='{Author}' />
            </li>
            <li>
                <label>IsOriginal:</label><select name='IsOriginal'><option value='true'>是</option><option value='false' {OriginalSelected}>否</option></select>
            </li>
            <li>
                <label>IsPublished:</label><select name='IsPublished'><option value='true'>是</option><option value='false' {PublishedSelected}>否</option></select>
            </li>
            <li>
                <label>&nbsp;</label><button>修改</button>
            </li>
        </ul>
    </div>";
        }

        public static string Detail()
        {
            return @"
#if(!$ArticleInfo)
<p>没有找到您要找的文章</p>
#else
<div id='ArticleDetail'>
    <h1>
        <span class='Title'>${ArticleInfo.Title}</span>
        <span class='DateCreated'>(${ArticleInfo.DateCreated})</span>
    </h1>
    <div class='Summary'>
        <pre>${ArticleInfo.Summary}</pre>
    </div>
    <div class='Content'>
        <pre>{Content}</pre>
    </div>
    <div class='Author'>
        {Author}
    </div>
</div>
";
        }
    }
}